package com.atguigu.handler;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 包名:com.atguigu.handler
 *
 * @author Leevi
 * 日期2021-09-07  15:05
 */
@Controller
@RequestMapping("/hello")
public class HelloHandler {
    @RequestMapping("/sayHello")
    public String sayHello(){
        int num = 10/0;
        return "target";
    }

    @RequestMapping("/getName")
    public String getName() throws ClassNotFoundException {
        Class.forName("dsadsafa");
        return "target";
    }

    @RequestMapping("/getAge")
    public String getAge() throws ClassNotFoundException {
        throw new RuntimeException("这是我故意抛出的异常！！！");
    }

    @RequestMapping("/getAddress")
    public String getAddress(){
        String str = null;
        System.out.println(str.length());
        return "target";
    }
}
